<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<script type="text/javascript" src="/${initParam.context_root}/script/pscript1.js"></script>
<script type="text/javascript" src="/${initParam.context_root}/script/pscript2.js"></script>
<script>
function chk_del(){
	var flag = confirm("영구적으로 삭제됩니다. 삭제하시겠습니까?");
	if(flag){
		return true;
	}else{
		return false;		
	}
}
function chk_recover(){
	var flag = confirm("상품목록으로 복구합니다. 진행하시겠습니까?");
	if(flag){
		return true;
	}else{
		return false;		
	}
}
</script>
<table>
	<tr align="center">
		<form action="/droowa/product/searchRProdctByName.do" onsubmit="return chk1(this)">
			<td width="160" bgcolor="#BDBDBD">상품</td>
			<td><input type="text" name="name" id="name" onkeyup="blank1()" style="width:300px"></td>
			<td><input type="submit" value="검색"></td>
			<td id="error1" width="200" style="color: red;"></td>
		</form>
	</tr>
	<tr align="center">
		<form action="/droowa/product/searchRProdctByCategory.do" onsubmit="return chk2(this)">
			<td width="160" bgcolor="#BDBDBD">카테고리</td>
			<td ><input type="text" name="categoryName" id="categoryName" onkeyup="blank2()" style="width:300px"></td>
			<td><input type="submit" value="검색"></td>
			<td id="error2" width="200" style="color: red;"></td>
		</form>
	</tr>
	<tr align="center">
		<form action="/droowa/product/searchRProdctByBrand.do" onsubmit="return chk3(this)">
			<td width="160" bgcolor="#BDBDBD">제조사</td>
			<td ><input type="text" name="brand" id="brand" onkeyup="blank3()" style="width:300px"></td>
			<td><input type="submit" value="검색"></td>
			<td id="error3" width="200" style="color: red;"></td>
		</form>
	</tr>
	<tr align="center">
		<form action="/droowa/product/searchRProdctByModelNo.do" onsubmit="return chk4(this)">
			<td width="160" bgcolor="#BDBDBD">모델번호</td>
			<td ><input type="text" name="modelNo" id="modelNo" onkeyup="blank4()" style="width:300px"></td>
			<td><input type="submit" value="검색"></td>
			<td id="error4" width="200" style="color: red;"></td>
		</form>
	</tr>
	<tr align="center">
		<form action="/droowa/product/searchRProdctByPriceRange.do" onsubmit="return chk5(this)">
			<td width="160" bgcolor="#BDBDBD">가격범위</td>
			<td ><input type="text" name="sPrice" id="sPrice" onkeyup="blank5()" style="width:143px">~<input type="text" name="ePrice" id="ePrice" onkeyup="blank6()" style="width:143px"></td>
			<td><input type="submit" value="검색"></td>
			<td id="error5" width="200" style="color: red;"></td>
		</form>
	</tr>
</table>
<h2 align="center">삭제 상품 목록</h2>

<table>
	<tr align="center" bgcolor="#BDBDBD">
		<td width="90"></td>
		<td width="65">아이디</td>
		<td width="90">카테고리</td>
		<td width="90">상품명</td>
		<td width="90">가격</td>
		<td width="90">제조사</td>
		<td width="90">모델번호</td>
		<td width="40">수량</td>
		<td width="370">상세설명</td>
		<td width="40">수정</td>
		<td width="40">복구</td>
		<td width="40">삭제</td>
	</tr>
	<tr><td align="center" colspan="11">${requestScope.no_result}</td></tr>
<c:forEach items="${requestScope.removed_product_list}" var="product">
	<tr align="center">
		<td width="90" height="90">
		<c:choose>
			<c:when test="${product.fileName!=null }">
				<img src="/droowa/product-img/${product.fileName}" style="width:90px; height=90px;">
			</c:when>
			<c:when test="${product.fileName==null}">
				<img src="/droowa/product-img/No_image.jpg" style="width:90px; height=90px;">
			</c:when>	
		</c:choose>
		</td>
		<td width="65">${product.id }</td>
		<td width="90">${product.categoryName }</td>
		<td width="90">${product.name }</td>
		<td width="90">${product.price }</td>
		<td width="90">${product.brand }</td>
		<td width="40">${product.modelNo }</td>
		<td width="40">${product.quantity }</td>
		<td width="370">${product.description }</td>
		<td>
			<a href="/droowa/product/getProductId.do?id=${product.id}">
				<input type="hidden" name="del" value="${product.del}">
				<input type="button" value="수정" style="width:40;">
			</a>
		</td>
		<td>
			<a href="/droowa/product/recoverProduct.do?id=${product.id}">
				<input type="button" value="복구" onclick="return chk_recover()"style="width:40;">
			</a>
		</td>
		<td>
			<a href="/droowa/product/finalRemoveProduct.do?id=${product.id}">
				<input type="button" value="삭제" onclick="return chk_del()" style="width:40;">
			</a>
		</td>
	</tr>
</c:forEach>
</table>
<!-- 페이징처리 -->
<c:if test="${fn:length(requestScope.removed_product_list) != 0 }">
<c:if test="${requestScope.flag=='byList'}">
<table align="center">
	<tr>
		<td>
<c:choose>
	<c:when test="${requestScope.paging.previousPageGroup}">
		<a href="/droowa/product/removedProductList.do?page=${requestScope.paging.startPageOfPageGroup-1}">◀</a>
	</c:when>
	<c:otherwise>
		◀
	</c:otherwise>
</c:choose>
<c:forEach begin="${requestScope.paging.startPageOfPageGroup}" end="${requestScope.paging.endPageOfPageGroup}" step="1" var="page">
	<c:choose>
		<c:when test="${page == requestScope.paging.currentPage }">
			<b>${page}</b>
		</c:when>
		<c:otherwise>
			<a href="/${initParam.context_root}/product/removedProductList.do?page=${page}">${page}</a>
		</c:otherwise>
	</c:choose>
</c:forEach>
<c:choose>
	<c:when test="${requestScope.paging.nextPageGroup}">
		<a href="/${initParam.context_root}/product/removedProductList.do?page=${requestScope.paging.endPageOfPageGroup+1}">▶</a>
	</c:when>
	<c:otherwise>
		▶
	</c:otherwise>
</c:choose>
		</td>
	</tr>
</table>
</c:if>
<c:if test="${requestScope.flag=='byName'}">
<table align="center">
	<tr>
		<td>
<c:choose>
	<c:when test="${requestScope.paging.previousPageGroup}">
		<a href="/droowa/product/searchRProdctByName.do?page=${requestScope.paging.startPageOfPageGroup-1}&name=${requestScope.name}">◀</a>
	</c:when>
	<c:otherwise>
		◀
	</c:otherwise>
</c:choose>
<c:forEach begin="${requestScope.paging.startPageOfPageGroup}" end="${requestScope.paging.endPageOfPageGroup}" step="1" var="page">
	<c:choose>
		<c:when test="${page == requestScope.paging.currentPage }">
			<b>${page}</b>
		</c:when>
		<c:otherwise>
			<a href="/${initParam.context_root}/product/searchRProdctByName.do?page=${page}&name=${requestScope.name}">${page}</a>
		</c:otherwise>
	</c:choose>
</c:forEach>
<c:choose>
	<c:when test="${requestScope.paging.nextPageGroup}">
		<a href="/${initParam.context_root}/product/searchRProdctByName.do?page=${requestScope.paging.endPageOfPageGroup+1}&name=${requestScope.name}">▶</a>
	</c:when>
	<c:otherwise>
		▶
	</c:otherwise>
</c:choose>
		</td>
	</tr>
</table>
</c:if>

<c:if test="${requestScope.flag=='byCategory'}">
<table align="center">
	<tr>
		<td>
<c:choose>
	<c:when test="${requestScope.paging.previousPageGroup}">
		<a href="/droowa/product/searchRProdctByCategory.do?page=${requestScope.paging.startPageOfPageGroup-1}&categoryName=${requestScope.categoryName}">◀</a>
	</c:when>
	<c:otherwise>
		◀
	</c:otherwise>
</c:choose>
<c:forEach begin="${requestScope.paging.startPageOfPageGroup}" end="${requestScope.paging.endPageOfPageGroup}" step="1" var="page">
	<c:choose>
		<c:when test="${page == requestScope.paging.currentPage }">
			<b>${page}</b>
		</c:when>
		<c:otherwise>
			<a href="/${initParam.context_root}/product/searchRProdctByCategory.do?page=${page}&categoryName=${requestScope.categoryName}">${page}</a>
		</c:otherwise>
	</c:choose>
</c:forEach>
<c:choose>
	<c:when test="${requestScope.paging.nextPageGroup}">
		<a href="/${initParam.context_root}/product/searchRProdctByCategory.do?page=${requestScope.paging.endPageOfPageGroup+1}&categoryName=${requestScope.categoryName}">▶</a>
	</c:when>
	<c:otherwise>
		▶
	</c:otherwise>
</c:choose>
		</td>
	</tr>
</table>
</c:if>

<c:if test="${requestScope.flag=='byBrand'}">
<table align="center">
	<tr>
		<td>
<c:choose>
	<c:when test="${requestScope.paging.previousPageGroup}">
		<a href="/droowa/product/searchRProdctByBrand.do?page=${requestScope.paging.startPageOfPageGroup-1}&brand=${requestScope.brand}">◀</a>
	</c:when>
	<c:otherwise>
		◀
	</c:otherwise>
</c:choose>
<c:forEach begin="${requestScope.paging.startPageOfPageGroup}" end="${requestScope.paging.endPageOfPageGroup}" step="1" var="page">
	<c:choose>
		<c:when test="${page == requestScope.paging.currentPage }">
			<b>${page}</b>
		</c:when>
		<c:otherwise>
			<a href="/${initParam.context_root}/product/searchRProdctByBrand.do?page=${page}&brand=${requestScope.brand}">${page}</a>
		</c:otherwise>
	</c:choose>
</c:forEach>
<c:choose>
	<c:when test="${requestScope.paging.nextPageGroup}">
		<a href="/${initParam.context_root}/product/searchRProdctByBrand.do?page=${requestScope.paging.endPageOfPageGroup+1}&brand=${requestScope.brand}">▶</a>
	</c:when>
	<c:otherwise>
		▶
	</c:otherwise>
</c:choose>
		</td>
	</tr>
</table>
</c:if>

<c:if test="${requestScope.flag=='byModelNo'}">
<table align="center">
	<tr>
		<td>
<c:choose>
	<c:when test="${requestScope.paging.previousPageGroup}">
		<a href="/droowa/product/searchRProdctByModelNo.do?page=${requestScope.paging.startPageOfPageGroup-1}&modelNo=${requestScope.modelNo}">◀</a>
	</c:when>
	<c:otherwise>
		◀
	</c:otherwise>
</c:choose>
<c:forEach begin="${requestScope.paging.startPageOfPageGroup}" end="${requestScope.paging.endPageOfPageGroup}" step="1" var="page">
	<c:choose>
		<c:when test="${page == requestScope.paging.currentPage }">
			<b>${page}</b>
		</c:when>
		<c:otherwise>
			<a href="/${initParam.context_root}/product/searchRProdctByModelNo.do?page=${page}&modelNo=${requestScope.modelNo}">${page}</a>
		</c:otherwise>
	</c:choose>
</c:forEach>
<c:choose>
	<c:when test="${requestScope.paging.nextPageGroup}">
		<a href="/${initParam.context_root}/product/searchRProdctByModelNo.do?page=${requestScope.paging.endPageOfPageGroup+1}&modelNo=${requestScope.modelNo}">▶</a>
	</c:when>
	<c:otherwise>
		▶
	</c:otherwise>
</c:choose>
		</td>
	</tr>
</table>
</c:if>

<c:if test="${requestScope.flag=='byPriceRange'}">
<table align="center">
	<tr>
		<td>
<c:choose>
	<c:when test="${requestScope.paging.previousPageGroup}">
		<a href="/droowa/product/searchRProdctByPriceRange.do?page=${requestScope.paging.startPageOfPageGroup-1}&sPrice=${requestScope.sPrice}&ePrice=${requestScope.ePrice}">◀</a>
	</c:when>
	<c:otherwise>
		◀
	</c:otherwise>
</c:choose>
<c:forEach begin="${requestScope.paging.startPageOfPageGroup}" end="${requestScope.paging.endPageOfPageGroup}" step="1" var="page">
	<c:choose>
		<c:when test="${page == requestScope.paging.currentPage }">
			<b>${page}</b>
		</c:when>
		<c:otherwise>
			<a href="/${initParam.context_root}/product/searchRProdctByPriceRange.do?page=${page}&sPrice=${requestScope.sPrice}&ePrice=${requestScope.ePrice}">${page}</a>
		</c:otherwise>
	</c:choose>
</c:forEach>
<c:choose>
	<c:when test="${requestScope.paging.nextPageGroup}">
		<a href="/${initParam.context_root}/product/searchRProdctByPriceRange.do?page=${requestScope.paging.endPageOfPageGroup+1}&sPrice=${requestScope.sPrice}&ePrice=${requestScope.ePrice}">▶</a>
	</c:when>
	<c:otherwise>
		▶
	</c:otherwise>
</c:choose>
		</td>
	</tr>
</table>
</c:if>
</c:if>
</body>